#include <iostream>
#define LL long long
using namespace std;

const int kMaxN = 2e5;

int a[kMaxN], sum[kMaxN];

int GetSum(int l, int r) {
  return sum[r] - sum[l - 1];
}

LL Solve1(int n) {
  LL ret = 0;
  for (int i = 1; i <= n; i++) {
    sum[i] = sum[i - 1] + a[i];
  }
  for (int i = 1; i <= n; i++) {
    ret += (LL)a[i] * GetSum(i + 1, n);
  }
  return ret;
}

LL Solve2(int n) {
  LL ret = 0;
  int s = 0;

  for (int i = 1; i <= n; i++) {
    ret -= (LL)a[i] * a[i];
    s += a[i];
  }
  ret += (LL)s * s;
  return ret / 2;
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  cout << Solve2(n) << "\n";
  return 0;
}